/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entity;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author USER
 */
@Entity
@Table(name = "seans")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Seans.findAll", query = "SELECT s FROM Seans s"),
    @NamedQuery(name = "Seans.findByIdSeans", query = "SELECT s FROM Seans s WHERE s.idSeans = :idSeans"),
    @NamedQuery(name = "Seans.findBySeansNo", query = "SELECT s FROM Seans s WHERE s.seansNo = :seansNo"),
    @NamedQuery(name = "Seans.findByTarih", query = "SELECT s FROM Seans s WHERE s.tarih = :tarih"),
    @NamedQuery(name = "Seans.findByActive", query = "SELECT s FROM Seans s WHERE s.active = :active")})
public class Seans implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idSeans")
    private Integer idSeans;
    @Basic(optional = false)
    @Column(name = "seansNo")
    private int seansNo;
    @Basic(optional = false)
    @Column(name = "tarih")
    @Temporal(TemporalType.TIMESTAMP)
    private Date tarih;
    @Basic(optional = false)
    @Column(name = "active")
    private boolean active;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "seansId")
    private Collection<Bilet> biletCollection;
    @JoinColumn(name = "filmId", referencedColumnName = "idFilm")
    @ManyToOne(optional = false)
    private Film filmId;
    @JoinColumn(name = "salonId", referencedColumnName = "idSalon")
    @ManyToOne(optional = false)
    private Salon salonId;

    public Seans() {
    }

    public Seans(Integer idSeans) {
        this.idSeans = idSeans;
    }

    public Seans(Integer idSeans, int seansNo, Date tarih, boolean active) {
        this.idSeans = idSeans;
        this.seansNo = seansNo;
        this.tarih = tarih;
        this.active = active;
    }

    public Integer getIdSeans() {
        return idSeans;
    }

    public void setIdSeans(Integer idSeans) {
        this.idSeans = idSeans;
    }

    public int getSeansNo() {
        return seansNo;
    }

    public void setSeansNo(int seansNo) {
        this.seansNo = seansNo;
    }

    public Date getTarih() {
        return tarih;
    }

    public void setTarih(Date tarih) {
        this.tarih = tarih;
    }

    public boolean getActive() {
        return active;
    }

    public void setActive(boolean active) {
        this.active = active;
    }

    @XmlTransient
    public Collection<Bilet> getBiletCollection() {
        return biletCollection;
    }

    public void setBiletCollection(Collection<Bilet> biletCollection) {
        this.biletCollection = biletCollection;
    }

    public Film getFilmId() {
        return filmId;
    }

    public void setFilmId(Film filmId) {
        this.filmId = filmId;
    }

    public Salon getSalonId() {
        return salonId;
    }

    public void setSalonId(Salon salonId) {
        this.salonId = salonId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idSeans != null ? idSeans.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Seans)) {
            return false;
        }
        Seans other = (Seans) object;
        if ((this.idSeans == null && other.idSeans != null) || (this.idSeans != null && !this.idSeans.equals(other.idSeans))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.Seans[ idSeans=" + idSeans + " ]";
    }
    
}
